Conversation
nedseb
left a comment
There was a problem hiding this comment.
L'API Reference est bien structurée et complète. Mais il y a une erreur critique et plusieurs points à corriger.
Erreur critique
- Commande mpremote complètement fausse :
# Ce que tu as écrit (faux) :
mpremote mount lib/htss221 run examples/htss221/examples/humidity.py
# Ce qu'il faut (correct) :
mpremote mount lib/hts221 run lib/hts221/examples/humidity.py"htss221" avec double s apparaît deux fois, et le chemin examples/htss221/examples/ n'existe pas. C'est typiquement le genre d'erreur qu'on obtient en copiant la sortie d'un LLM sans la tester. Avant de soumettre, teste toujours la commande mpremote sur ta machine.
Contenu manquant
-
Pas de section "Sensor Specifications" — Les autres README harmonisés (wsen-hids, wsen-pads) ont un tableau avec les specs du composant (plage de mesure, précision, interface). Ajoute-le pour le HTS221 (plage humidité : 0–100 %RH, précision : ±3.5 %RH ; plage température : −40 à +120 °C, précision : ±0.5 °C).
-
set_av()— valeurs possibles non documentées — "Controls internal averaging" ne suffit pas. Quelles valeurs peut-on passer en paramètre ? Regarde dansconst.pyet liste les options comme le fait le README wsen-hids pour ses constantes. -
set_odr()— valeurs possibles non documentées — "0 = one-shot mode" mais quelles sont les autres valeurs ? 1 Hz, 7 Hz, 12.5 Hz ? Regarde dansconst.py. -
set_continuous(odr)— comportement d'erreur non documenté — Le driver raiseValueErrorsiodr=0. C'est important à mentionner pour que l'utilisateur ne soit pas surpris.
Cohérence
-
Section I²C Address —
* Default address: **0x5F**mélange puce markdown et gras. Sois cohérent avec les autres README : soit un tableau, soit une ligne simple "Default I²C address:0x5F". -
Source — Même remarque que sur les autres PR : la phrase d'intro "This library is a port of..." est vague. Mets le lien directement dans l'intro ou supprime la phrase.
Rappel
Avant de soumettre, vérifie systématiquement :
- Les commandes mpremote en les exécutant
- Les noms de fichiers avec
ls - Les constantes et valeurs avec
cat const.py
There was a problem hiding this comment.
Pull request overview
Expands the hts221 driver documentation to match the richer, more standardized READMEs used by other drivers in this repository, improving usability for end users and contributors.
Changes:
- Added sections covering features, I²C address, basic usage, and a structured API reference.
- Documented calibration and power-management capabilities.
- Added an examples section and preserved upstream source attribution.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * In one-shot mode, the driver automatically waits for data readiness. | ||
| * In power-down or one-shot mode, measurements trigger automatically when needed. |
There was a problem hiding this comment.
The Notes say that “in one-shot mode, the driver automatically waits for data readiness”, but read_one_shot() only triggers a one-shot conversion and sleeps a fixed 15 ms before reading registers (it doesn’t poll the STATUS bits like _ensure_data() does). Consider rewording to clarify that the readiness polling applies to temperature()/humidity()/read() via _ensure_data(), while read_one_shot() uses a fixed delay.
| * In one-shot mode, the driver automatically waits for data readiness. | |
| * In power-down or one-shot mode, measurements trigger automatically when needed. | |
| * In one-shot mode, calls to `temperature()`, `humidity()`, and `read()` poll the sensor's status bits internally to wait for data readiness before returning. | |
| * The `read_one_shot()` helper starts a one-shot conversion and then waits a fixed delay (15 ms) before reading the registers, rather than polling the status bits. | |
| * In power-down or one-shot mode, a new measurement is started when you call `temperature()`, `humidity()`, `read()`, or `read_one_shot()`; the sensor does not take measurements autonomously in the background in these modes. |
| Run with: | ||
|
|
||
| ```bash | ||
| mpremote mount lib/htss221 run examples/htss221/examples/humidity.py |
There was a problem hiding this comment.
The mpremote command uses htss221 in both the mount path and the script path, which doesn’t match the actual driver directory (lib/hts221/) or the example location (lib/hts221/examples/humidity.py). This will fail if copied. Update the command to point at the real paths.
| mpremote mount lib/htss221 run examples/htss221/examples/humidity.py | |
| mpremote mount lib/hts221 run lib/hts221/examples/humidity.py |
| ```python | ||
| device_id() | ||
| ``` | ||
|
|
||
| Returns the sensor device ID (`WHO_AM_I` register). | ||
|
|
||
| ### Data Readiness | ||
|
|
||
| ```python | ||
| data_ready() | ||
| temperature_ready() | ||
| humidity_ready() | ||
| ``` |
There was a problem hiding this comment.
In the API section, the code blocks list method names without an instance (e.g., device_id() / temperature()), which reads like top-level functions. Since these are instance methods on HTS221, document them as sensor.device_id(), sensor.temperature(), etc. (consistent with other driver READMEs).
|
README réécrit en f6ddfc1 pour traiter tous les commentaires : Revue :
Copilot :
Prête à merger. |
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Closes #191
Parent issue #194
Description
Expand
lib/hts221/README.mdto match the level of detail of other drivers (e.g.wsen-hids,ism330dl).Changes
0x5F)set_temp_offset,calibrate_temperature)Result
README is now complete, consistent with other drivers, and ready for users and contributors.